import request from '@/utils/request'

const baseURL = 'http://localhost:39203/carbon/emission_factor'

/**
 * 查询所有原料
 * @returns {AxiosPromise}
 */
export function queryAllMaterial() {
  return request({
    url: '/queryAllMaterial',
    method: 'get',
    baseURL: baseURL
  })
}

/**
 * 删除排放因子
 * @returns {AxiosPromise}
 */
export function deleteFactor(id) {
  return request({
    url: `/deleteFactor/${id}`,
    method: 'delete',
    baseURL: baseURL
  })
}

/**
 * 批量删除排放因子
 * @returns {AxiosPromise}
 */
export function deleteBatchFactor(data) {
  return request({
    url: `/deleteBatchFactor`,
    method: 'delete',
    data: data,
    baseURL: baseURL
  })
}

/**
 * 分页条件查询
 * @returns {AxiosPromise}
 */
export function pageFactorList(data) {
  return request({
    url: `/pageList`,
    method: 'post',
    data: data,
    baseURL: baseURL
  })
}

/**
 * 添加排放因子
 * @returns {AxiosPromise}
 */
export function addFactor(data) {
  return request({
    url: `/addFactor`,
    method: 'put',
    data: data,
    baseURL: baseURL
  })
}

/**
 * 编辑排放因子
 * @returns {AxiosPromise}
 */
export function editFactor(data) {
  return request({
    url: `/editFactor`,
    method: 'put',
    data: data,
    baseURL: baseURL
  })
}

/**
 * 查询排放因子详情
 * @returns {AxiosPromise}
 */
export function queryDetail(id) {
  return request({
    url: `/queryDetail/${id}`,
    method: 'get',
    baseURL: baseURL
  })
}
